import Vue from 'vue';
import VueRouter from 'vue-router';
// import Page404 from '../views/PageError404.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '../views/LoginView.vue'),
  },
  {
    path: '/main',
    component: () => import(/* webpackChunkName: "main" */ '../views/MainView.vue'),
    children: [
      {
        path: '/',
        name: 'main',
        redirect: 'a',
      },
      {
        path: 'a',
        name: 'a',
        component: () => import(/* webpackChunkName: "a" */ '@/views/AView.vue'),
      },
      {
        path: 'b',
        name: 'b',
        component: () => import(/* webpackChunkName: "b" */ '@/views/BView.vue'),
      },
      {
        path: 'c',
        name: 'c',
        component: () => import(/* webpackChunkName: "c" */ '@/views/CView.vue'),
      },
    ],
  },
  // {
  //   path: '/*',
  //   component: Page404,
  // },

];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
